package com.itheima.converter;

import org.springframework.core.convert.converter.Converter;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @Author a2687
 * @create 2021/9/13 20:01
 */
public class DateConverter implements Converter<String, Date> {


    public Date convert(String stringDate) {
        System.out.println("开始日期转化");
        SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date createDate=null;
        try {
            createDate=format.parse(stringDate);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return createDate;
    }
}
